package com.jing.mvp_demo.Presenter;

import com.jing.mvp_demo.Model.User;
import com.jing.mvp_demo.View.LoginView;
import com.jing.mvp_demo.View.RegisterView;

public class RegisterPresenter {
    private RegisterView registerView;

    public RegisterPresenter(RegisterView registerView) {
        this.registerView = registerView;
    }

    public void register(String username, String password) {
        if (username.isEmpty()) {
            registerView.setUsernameError();
            return;
        }

        if (password.isEmpty()) {
            registerView.setPasswordError();
            return;
        }

//        if (!password.equals(confirmPassword)) {
//            registerView.setConfirmPasswordError();
//            return;
//        }

        // 在实际应用中，这里应该包含用户注册逻辑，例如向服务器发送注册请求等
        // 这里简化为直接注册成功
        registerView.showRegistrationSuccessfulMessage();
    }
}